#pragma once

#include "StockNamespace.h"
#include "StockTypes.h"

#include <vector>

STOCK_NS_BEGIN

class DealState;
class Visitor;

class StrategyNode
{
public:
	StrategyNode(TransactionType transaction = PASS);
	virtual ~StrategyNode();

	std::vector<StrategyNode *> DoAvailableTransactions(StockPrice curPrice);

	void CalcProfit(StockProfit curProfit, StockPrice curPrice);
	void SetState(DealState * state);

	void AddChildrenNodes(std::vector<StrategyNode *> children);
	std::vector<StrategyNode *> GetChildren();
	void SetParent(StrategyNode * node);
	StrategyNode * GetParent();

	StockProfit GetProfit();
	TransactionType GetTransaction();

	void Accept(Visitor * visitor);
private:
	DealState * _deal_state;

	StockProfit _profit;
	TransactionType _transaction;

private:
	std::vector<StrategyNode *> _children;

	StrategyNode * _parent;
};

STOCK_NS_END
